/** @file 
 *	@class Input
 *  @brief A controller that handles input from the player's mouse and keyboard
 *
 *  The StateManager inherits from the Ogre Framelistener, and uses the
 *	frameRenderingQueued method to run through a list of controllers
 *	to make sure they are updated
 */

#include "stdafx.h"
/*
#include "Input.h"

Input::Input(Ogre::RenderWindow* window) {
	initialize(window);
}

void Input::initialize(Ogre::RenderWindow* window) {
	m_window = window;

  OIS::ParamList pl;
  size_t windowHnd = 0;
  std::ostringstream windowHndStr;

  m_window->getCustomAttribute("WINDOW", &windowHnd);
  windowHndStr << windowHnd;
  pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

  m_inputManager = OIS::InputManager::createInputSystem( pl );

  m_keyboard = static_cast<OIS::Keyboard*>(m_inputManager->createInputObject( OIS::OISKeyboard, true ));
  m_mouse = static_cast<OIS::Mouse*>(m_inputManager->createInputObject( OIS::OISMouse, true ));

  m_mouse->setEventCallback(this);
  m_keyboard->setEventCallback(this);
  
  windowResized(m_window);

	Ogre::WindowEventUtilities::addWindowEventListener(m_window, this);
}

Input::~Input() {
	//Remove ourselves as a window listener
	 Ogre::WindowEventUtilities::removeWindowEventListener(m_window, this);
	 windowClosed(m_window);	 
}

//Adjust mouse clipping area
void Input::windowResized(Ogre::RenderWindow* rw)
{
    unsigned int width, height, depth;
    int left, top;
    rw->getMetrics(width, height, depth, left, top);

    const OIS::MouseState &ms = m_mouse->getMouseState();
    ms.width = width;
    ms.height = height;
}

//Unattach OIS before window shutdown (very important under Linux)
void Input::windowClosed(Ogre::RenderWindow* rw)
{
    //Only close for window that created OIS
    if( rw == m_window )
    {
        if( m_inputManager )
        {
            m_inputManager->destroyInputObject( m_mouse );
            m_inputManager->destroyInputObject( m_keyboard );

            OIS::InputManager::destroyInputSystem(m_inputManager);
            m_inputManager = 0;
        }
    }
}


bool Input::keyPressed(const OIS::KeyEvent &arg)
{
	return true;
}
bool Input::keyReleased(const OIS::KeyEvent &arg)
{
	return true;
}
bool Input::mouseMoved( const OIS::MouseEvent &arg )
{

	return true;
}
bool Input::mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
	return true;
}
bool Input::mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id )
{
	return true;

}*/